$('#login-button').click(function () {
    //  console.log("ss")
    let username = $('#username').val()
    let pwd = $('#pwd').val()
   
   ajax({
       url:"./denglu.php",
       data:{
           username:username,
           pwd:pwd,
       },
       type:"GET",
       callback:function(res){
           console.log(res)
           var res=JSON.parse(res)
           
           if(res.code===0){
               
               alert(res.msg)
                document.cookie="name="+username
                document.cookie="value="+pwd
                var d = new Date();
                 d.setDate( d.getDate() + 1 );
                 document.cookie="expires="+d
                // window.location.href="index.html"
               
           }
           else if(res.code===1){
               console.log(res)
               alert(res.msg)   
           }   
           else if(res.code===2){
            alert(res.msg)   
            var d = new Date();
            d.setDate( d.getDate() + 1 );
            document.cookie= `name=${username};expires=${d}`
           }
       }
   })
  
})